<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        html,body{
            height:100%;
            padding: 0;
            margin: 0;
        }
        #box{
            height: 100%;
        }
        #control{
            position: absolute;
            top: 0;
            left: 0;
            z-index: 99;
        }
    </style>
</head>
<body>
    <div id="box">
    </div>
    <div id="control">
        <ul>
            <li onclick="drawRect()">矩形</li>
        </ul>
    </div>
</body>
<script src="http://192.168.80.70:5500/imgDraw.js"></script>
<!-- <script src="./imgDraw.js"></script> -->
<script src="./DrawEncaTest.js"></script>
<script src="./DrawEnca2.js"></script>
<script src="./data/encaData2.js"></script>
<script src="./data/encaData3.js"></script>
<!-- <script src="./PCBDraw.js"></script> -->
<script>
    // console.log(test())
    // a.getPins(["b","bs_t","bs_b","bp_t","bp_b","t","ts_t","ts_b","tp_t","tp_b","i","is_t","is_b","ip_t","ip_b","drill"]);
    // a.getLayer(["st","sb","at","ab","sm_t","sm_b","et","eb","bt","bb","pt","pb"]);
    // function drawRect(){
    //     console.log("绘制");
    //     a.drawRect();
    // }
    // console.log(a)
    function setData(encaData){
        var a = new DrawEncapsulation({
            encaData:encaData,
            parent:"#box",
            grid:true,
            edit:true
        });
        a.changeView(["st","sb","at","ab","sm_t","sm_b","et","eb","bt","bb","pt","pb"],["b","bs_t","bs_b","bp_t","bp_b","t","ts_t","ts_b","tp_t","tp_b","i","is_t","is_b","ip_t","ip_b","drill"]);
        console.log(a)
    }

    // if(navigator.serviceWorker){
    //     let worker = navigator.serviceWorker.register("sw.js");
    //     worker.then(res=>{
    //         console.log(res);
    //     }).catch(err=>{
    //         console.log(err);
    //     })
    // }
    
    // var enca = new Encapsulation(encaData3);

    // console.log(enca);

    setData(encaData3);
</script>
 </html>